package spring.boot.notes.jacquesh.event2.project.listenters;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import spring.boot.notes.jacquesh.event.project.event.WeatherEvent;

import java.util.List;

@Component
public  abstract class  AbstractEventMultister  implements  EventMulticaster{
	@Autowired
	private List<WeatherListenter> listenters;
	@Override
	public void multicastEvent(WeatherEvent weatherEvent) {
      start();
		listenters.forEach(i->i.onWeatherEvent(weatherEvent));
      end();
	}
	@Override
	public void addListenter(WeatherListenter listenter) {

	}
	@Override
	public void removeListenter(WeatherListenter listenter) {

	}
	protected abstract void end();
	protected abstract void start();



}
